<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function Father (uname, age) {
            this.uname = uname;
            this.age = age;
        }
        Father.prototype.money = function () {
            console.log(10000000000);
        }
        // 继承prototype上的属性和方法 pink老师版本
        // Son.prototype = new Father();
        // Son.prototype.constructor = Son;

        // ES5合并对象
        // 继承prototype上的属性和方法
        // 把Father.prototype合到Son.prototype上
        Son.prototype = Object.assign(Son.prototype, Father.prototype);
        Son.prototype.exam = function () {
            console.log(2000000000);
        }
        // 继承this上的属性和方法
        function Son (uname, age, score) {
            Father.call(this, uname, age),
            this.score = score;
        }
        const son = new Son('小小', '男' , 100);
        console.log(son);
        console.log(Son.prototype.constructor);
    </script>
</body>
</html>